#ifndef __VIMOCK_OBJECT_HOLDER__
#define __VIMOCK_OBJECT_HOLDER__

#include <vector>
#include <memory>
#include "bad_object_cast.hpp"

namespace vimock {
class object;
class _object_holder {
public:
	virtual ~_object_holder() {
	}
public:
	virtual bool equals(object thatObj) const = 0;
public:
	template <typename ToType>
	ToType to() const {
		if (typeid(ToType) != get_type()) {
			throw bad_object_cast();
		}
		return *(static_cast<const ToType * const>(get_value()));
	}
protected:
	virtual const std::type_info & get_type() const = 0;
	virtual const void * const get_value() const = 0;
};
typedef std::tr1::shared_ptr<_object_holder> object_holder;
}

#endif //__VIMOCK_OBJECT_HOLDER__

